#!/bin/bash
set -e

repo_name="pkg-repos"
rm -fr ${repo_name}
git clone https://gitee.com/wangchong1995924/${repo_name}.git
rm -fr ${repo_name}/n
for pkg in $(cat pkglist)
do
	mkdir -p ${repo_name}/n/${pkg}
	pkgfile="${repo_name}/n/${pkg}/${pkg}"
	echo "---" > ${pkgfile}
	echo "url:" >> ${pkgfile}
	echo "- https://gitee.com/src-openeuler/${pkg}.git" >> ${pkgfile}
done

cd ${repo_name}
git add .
git commit -m "add pkg"
git push
cd -
rm -fr ${repo_name}
